package com.ihisun.tmhcms.core.dao.userdao;

import com.ihisun.tmhcms.core.dto.userdto.PreRevenueDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface PreRevenueDao extends JpaRepository<PreRevenueDto, Long> {

    @Query(value = "select sum(money) from pre_revenue where recommend_uuid=:uuid and Order_state=3", nativeQuery = true)
    public Double findByrecommendUuid(@Param("uuid") String uuid);

    @Query(value = "select sum(personal_performance)+sum(team_performance)from pre_revenue where recommend_uuid=:uuid and Order_state=3", nativeQuery = true)
    public Double findByachievement(@Param("uuid") String uuid);

    public List<PreRevenueDto> findByRecommendUuidAndOrderState(String uuid, String orderState);

}
